//
//  main.m
//  复制（NSCopying）
//
//  Created by apple on 15/8/29.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Paper.h"
#import "Newspaper.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        
//      复制：子类会继承父类的复制的能力；
        
        
//      复制会把对象中里面的所有东西复制过来，生成一个新的对象
        
        
        Paper *paper1 = [[Paper alloc] init];
        paper1.weight = 1;
        NSLog(@"%p",&paper1);
        
        Paper *paper2 = [paper1 copy];
        NSLog(@"%f",paper2.weight);
        NSLog(@"%p",&paper2);
        
//        ------------------------------------------
        
        Newspaper *newspaper1 = [[Newspaper alloc] init];
        Newspaper *newspaper2 = [newspaper1 copy];
        if ([newspaper2 isKindOfClass:[Newspaper class]])
        {
            NSLog(@"两者是同一类型");
        }
        else
        {
            NSLog(@"两者类型不同");
        }

    
    }
    return 0;
}
